package com.itheima.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
//@WebFilter(urlPatterns = "/login")
public class DemoFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
        System.out.println("执行init（）方法");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException, ServletException {
        System.out.println("放行前的逻辑");
      filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("放行后的逻辑");

    }

    @Override
    public void destroy() {
        System.out.println(" destroy()销毁");

    }
}
